import React from 'react'
import { messages } from "share/common"
import { Icon, Popover } from 'antd'
import summaryCheckInfo from 'images/expense/summary-check-info.png'

let ruleOptions = [{
  id: 'name',
  label: messages('expense-reimbursement-control.key31')/*规则名称*/,
  type: 'languageInput',
  length: 100,
  placeholder: messages('common.please.input'/*请输入*/),
  rules: [{
    required: true,
    message: messages('common.please.input'/*请输入*/)
  }]
}, {
  id: 'expenseTypes',
  label: (
    <span> {messages('common.expense.type')/*费用类型*/}
      <Popover content={messages('expense-reimbursement-control.key51')/*费用类型多选会按照累计求和共同占用标准。*/}
               overlayStyle={{maxWidth: 400}}>
        <Icon type="info-circle" className='default-color-font' style={{cursor: 'pointer', marginLeft: 5}} />
      </Popover>
    </span>
  ),
  type: 'chooser',
  chooserType: 'selectInvoiceType',
  valueKey: 'expenseTypeOID',
  labelKey: 'name',
  listExtraParams: {subsidyType: 0},
  rules: [{
    required: true,
    message: messages('common.please.select'/*请选择*/)
  }]
}, {
  id: 'userGroups',
  label: (
    <span> {messages('expense-reimbursement-control.key29')/*适用人员*/}
      <Popover content={messages('expense-reimbursement-control.key52')/*决定哪些费用归属人将命中该条规则。如：基本标准中分别添加了人员A、B的标准，则此处可添加A+B。*/}
               overlayStyle={{maxWidth: 400}}>
        <Icon type="info-circle" className='default-color-font' style={{cursor: 'pointer', marginLeft: 5}} />
      </Popover>
    </span>
  ),
  type: 'chooser',
  placeholder: messages('expense-reimbursement-control.key28')/*通用*/,
  chooserType: 'user_group',
  valueKey: 'userGroupOID',
  labelKey: 'name',
  listExtraParams: {},
  rules: []
}, {
  id: 'forms',
  label: messages('expense-reimbursement-control.key53')/*适用单据*/,
  type: 'chooser',
  placeholder: messages('expense-reimbursement-control.key28')/*通用*/,
  chooserType: 'select_form',
  valueKey: 'formOID',
  labelKey: 'formName',
  listExtraParams: {},
  rules: []
}, {
  id: 'companys',
  label: messages('expense-reimbursement-control.key54')/*适用公司*/,
  type: 'chooser',
  placeholder: messages('expense-reimbursement-control.key28')/*通用*/,
  chooserType: 'available_company_setOfBooks',
  valueKey: 'companyOID',
  labelKey: 'name',
  listExtraParams: { enabled: true },
  rules: []
}, {
  id: 'controlType',
  label: (
    <span> {messages('expense-reimbursement-control.key33')/*控制方式*/}
      <Popover content={<img src={summaryCheckInfo} style={{width: 800}}/>}
               overlayStyle={{maxWidth: 832}}>
        <Icon type="info-circle" className='default-color-font' style={{cursor: 'pointer', marginLeft: 5}} />
      </Popover>
    </span>
  ),
  type: 'select',
  initialValue: 'DAY',
  options: [{
    value: 'DAY',
    title: messages('expense-reimbursement-control.key34')/*每天*/,
    description: messages('expense-reimbursement-control.key55')/*将费用发生日期同一天的费用金额相加，和当前设置的标准校验。对同费用归属人跨报销单校验*/,
  },{
    value: 'MONTH',
    title: messages('expense-reimbursement-control.key35')/*每月*/,
    description: messages('expense-reimbursement-control.key56')/*将费用发生日期同一月份的费用金额相加，和当前设置的标准校验。对同费用归属人跨报销单校验*/,
  },{
    value: 'QUARTER',
    title: messages('expense-reimbursement-control.key36')/*每季度*/,
    description: messages('expense-reimbursement-control.key57')/*将费用发生日期同一季度的费用金额相加，和当前设置的标准校验。对同费用归属人跨报销单校验*/,
  }, {
    value: 'SUMMARY',
    title: messages('expense-reimbursement-control.key37')/*汇总校验*/,
    description: messages('expense-reimbursement-control.key58')/*将受管控的费用金额累计相加，并和标准累计相加后的值进行校验。对同费用归属人报销单内校验*/
  }],
  rules: [{
    required: true,
    message: messages('common.please.select'/*请选择*/)
  }]
}, {
  id: 'crossCompanyStandard',
  label: messages('expense-reimbursement-control.key59')/*跨公司报销获取标准*/,
  type: 'select',
  disabled: true,
  initialValue: 'OWNER',
  options: [{
    value: 'OWNER',
    title: messages('expense-reimbursement-control.key44')/*费用归属人*/,
    description: messages('expense-reimbursement-control.key60')/*取费用归属人所在公司下的标准*/,
  },{
    value: 'DOC',
    title: messages('expense-reimbursement-control.key45')/*单据所选公司下的标准*/,
    description: messages('expense-reimbursement-control.key61')/*优先获取费用归属人在单据所选公司的标准。取不到时按照当前费用归属人本公司的级别，获取在单据所选公司同级别的标准*/,
  }],
  rules: [{
    required: true,
    message: messages('common.please.select'/*请选择*/)
  }]
}, {
  id: 'controlLevel',
  label: messages('expense-reimbursement-control.key62')/*控制力度*/,
  type: 'radio',
  initialValue: 'WARN',
  options: [{
    value: 'WARN',
    title: messages('expense-reimbursement-control.key46')/*警告*/
  }, {
    value: 'FORBID',
    title: messages('expense-reimbursement-control.key47')/*禁止*/
  }],
  rules: [{
    required: true,
    message: messages('common.please.select'/*请选择*/)
  }]
}, {
  id: 'complianceCheck',
  label: messages('expense-reimbursement-control.key63')/*合规校验*/,
  type: 'switch',
  disabled: true,
  rules: []
}, {
  id: 'status',
  label: messages('common.column.status')/*状态*/,
  type: 'switch',
  initialValue: true,
  rules: []
}, {
  id: 'message',
  label: messages('expense-reimbursement-control.key64')/*提示内容*/,
  type: 'languageInput',
  length: 300,
  textArea: true,
  placeholder: messages('common.max.characters.length', {max: 300}/*最多输入300个字符*/),
  rules: []
}];

export default ruleOptions
